package day05;
import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {
        /*int[] a= new int[3];
        int[] b=new int[4];
        double[] c=new double[4];
        double[] d=new double[5];
        boolean[] e=new boolean[7];
        boolean[] r=new boolean[3];
        int[]arr=new int[3];
        int[]err=new int[4];
        int[]de={1,2,6};
        int[]tt={1,6,15,4};
        int[] are=new int[]{1,2,3,4};
        int[] be=new int[]{12,45,65,14};
        int[] art;
        art=new int[]{12,45,78,14};
        int[] ao;
        //ao={12,14,45,75};  编译错误，脂肪是只能声明同时初始化


        int[] tr=new int[3];
        double[] se=new double[12];
        boolean[] fe=new boolean[12];
        int[] re;
        re=new int[]{12,14,15,22};
        int[] yu=new int[]{14,15,36};

        int[] ne=new int[3];
        ne[1]=100;
        ne[0]=12;
        ne[2]=66;
        System.out.println(ne[ne.length-1]);

        double[] he= new double[3];
        double[] she=new double[]{12.2,15.0,49.36,14.15};
        she[3]=100.5;
        he[0]=15;
        he[1]=88;
        he[2]=996.36;
        System.out.println(she[she.length-2]);

     int[] ad=new int[]{12,14};
     int[] le=new int[6];
     le[0]=15;
     le[1]=36;
     System.out.println(le[le.length-1]);

   int[] arr=new int[10];
   for(int i=0;i<=arr.length-1;i++){
       arr[i]=(int)(Math.random()*100);
       System.out.println(arr[i]+"\t");
   }

int[] de=new int[12];
   for(int e=0;e<de.length;e++){
       de[e]=(int)(Math.random()*1000);
       System.out.println(de[e]+"\t");
   }
        int min=arr[0];
        for(int r=1;r<arr.length;r++){
            if(arr[r]<arr[0]){
                min=arr[r];
            }
        }
        System.out.println("最小值为："+min);
int max=de[0];
   for(int i=1;i<de.length;i++){
       if(de[0]<de[i]){
           max=de[i];
       }
   }
System.out.println("最大值为："+max);*/

    int arr[]=new int[10];
    for(int i=0;i<arr.length;i++) {
        arr[i]= (int)(Math.random()*1000);
        System.out.println(arr[i]);

    }
    System.out.println("排序后");
        Arrays.sort(arr);
   for(int i=0;i<arr.length;i++){
       System.out.println(arr[i]);
   }
   System.out.println("倒着输出");
   for(int i=arr.length-1;i>=0;i--){
       System.out.println(arr[i]);
   }
   System.out.println("第三个数");
  System.out.println(arr[2]);































    }
}
